#!/usr/bin/env bash
#########################################################################
# File Name   : FILENAME
# Author      : seadog
# mail        : seadog0514@163.com
# Version     : 0.1
# Created Time: DATETIME
#########################################################################

#
#
# Usage:

{
  set -euo pipefail
  # set -E
  #     If set, any trap on ERR is inherited by shell functions, command
  #     substitutions, and commands executed in a subshell environment.

  export TZ="Asia/Shanghai"
  APP_ROOT=$(dirname "$(readlink -fm "$0")")
  cd "${APP_ROOT}"
}

source /root/keystonerc

# create a project
openstack --insecure project create --domain default --description "Hiroshima Project" hiroshima

# create a user
openstack --insecure user create --domain default --project hiroshima --password {{ openstack_user_password }} {{ openstack_user_name }}

openstack --insecure role list

# add a user to the [member] role
openstack --insecure role add --project hiroshima --user {{ openstack_user_name }} member
